export default {
    namespaced: true,
    state: {
      list: [
        {
          id: 1,
          title: '示例文章标题',
          date: '2024-03-20',
          tags: ['Vue', '前端'],
          excerpt: '这是一篇示例文章的摘要内容...',
          content: '这是文章的完整内容...'
        }
      ]
    },
    getters: {
      getPostById: (state) => (id) => {
        return state.list.find(post => post.id === parseInt(id))
      }
    },
    mutations: {
      ADD_POST(state, post) {
        state.list.push(post)
      }
    },
    actions: {
      addPost({ commit }, post) {
        commit('ADD_POST', post)
      }
    }
  }